package com.example.lhh.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import java.util.ArrayList;

/**
 * @author luoHongHu
 * @Description TODO
 * @date 2025年04月26日 16:42
 */
@Configuration
@EnableSwagger2
public class SwaggerConfig {

    @Bean
    public Docket api() {
        return new Docket(DocumentationType.SWAGGER_2).
                apiInfo(apiInfo())
                .groupName("lhh")
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.example.lhh.controller"))
                .paths(PathSelectors.any())
                .build();
    }

    //        this.title = title;
    //        this.description = description;
    //        this.version = version;
    //        this.termsOfServiceUrl = termsOfServiceUrl;
    //        this.contact = contact;
    //        this.license = license;
    //        this.licenseUrl = licenseUrl;
    //        this.vendorExtensions = Lists.newArrayList(vendorExtensions);
    private ApiInfo apiInfo() {
        Contact contact = new Contact("luoHongHu","https://gitee.com/luohonghu","2518813536@qq.com");
        return new ApiInfo("药店进销存管理系统",
                "药店进销存管理系统前后端接口api管理",
                "10",
                "",
                contact,
                "Apache 2.0",
                "http://www.apache.org/licenses/LICENSE-2.0",
                new ArrayList<>());
    }
}
